package com.example.controller.schedule;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Conditional;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

@Slf4j
@Component
@Conditional(IpCondition.class)
public class TimeTask {

    // 每五秒执行一次
    @Scheduled(cron = "0/5 * * * * ?")
    public void cron(){
        System.out.println("定时任务测试 "+ new Date());
    }


}
